home *** CD-ROM | disk | FTP | other *** search
- /* ================================================================ */
- /* Utilities */
- /* ---------------------------------------------------------------- */
-
- #define maxStrings 30
-
- extern char letterArray[5];
- extern Boolean hasEditFields;
-
- isoptionkey()
- {
- return(iskeydown(58));
- };
-
- iskeydown(keycode)
- int keycode;
- {
- /* returns true if the key specified in the map by
- keycode is down false otherwise */
-
- KeyMap thekeys;
- long mask;
- int bank;
- int temp;
-
- GetKeys(&thekeys); /* check what keys are down -- Option is 58 */
-
- bank = keycode / 32; /* get the right bank to use */
- temp = (keycode % 32); /* ok now get the byte .... */
-
- temp = ((temp / 8 ) * 8 ) + ( 7 - (temp % 8));
-
- mask = 1L << ( 31 - temp);
- if (( thekeys.Key[bank] & mask ) == 0 )
- return(0);
- else
- return(1);
- };
-
- /* ================================================================ */
- void FlashItem(theDialog, theItem)
- register DialogPtr theDialog;
- register int theItem;
- /* ---------------------------------------------------------------- */
- {
- int theKind;
- Handle theHandle;
- Rect theRect;
- long dummy;
-
- GetDItem(theDialog, theItem, &theKind, &theHandle, &theRect);
- HiliteControl(theHandle, 1); /* Turn it on */
- Delay(8L, &dummy);
- HiliteControl(theHandle, 0); /* Turn it off */
-
- }
-
- /* ================================================================ */
- void WalkList(theDialog)
- register DialogPtr theDialog;
- /* ---------------------------------------------------------------- */
- {
- int theKind, itemCount, theItem=1, counter=1;
- Handle theHandle;
- Rect theRect;
- Str255 theString;
-
- BlockMove(*(((DialogPeek)theDialog)->items), &itemCount, sizeof(int));
- do
- {
- GetDItem(theDialog, theItem, &theKind, &theHandle, &theRect);
- if (theKind==(ctrlItem+btnCtrl)) /* should not be rads or checks in alert */
- {
- GetCTitle(theHandle, &theString);
- if ((IUCompString(theString,"\pCancel")==0) ||
- (IUCompString(theString,"\pCANCEL")==0))
- letterArray[counter] = '.'; /* default to . */
- else
- {
- if ((theString[1]>0x40) && (theString[1]<0x60))
- theString[1] = theString[1]+0x20;
- letterArray[counter] = theString[1]; /*get the first char - and mask case*/
- }
- }
- else if ((theKind==editText+itemDisable) ||
- (theKind==editText))
- {
- hasEditFields = TRUE; /* it helps to set this flag */
- letterArray[counter] = ''; /* NOTHING */
- }
- else
- {
- letterArray[counter] = ''; /* NOTHING */
- }
- if (counter==5)
- {
- GetCTitle(theHandle, &theString);
- if (IUCompString(theString,"\pEject")==0) /*must be StdFile*/
- hasEditFields = TRUE;
- }
- counter++;
- if (counter>maxStrings) {theItem=itemCount+1;}
- theItem++; /* it would help to increment the item# */
- } while (theItem<=itemCount);
-
- }
-
-